/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cnd;

/**
 *
 * @author marten
 */
public class Search extends Thread{
    String query;
    SearchResults resultslist;
    CampusSearch campussearch;
    public Search(String query, SearchResults resultslist){
        this.query = query;
        this.resultslist = resultslist;
        campussearch = new CampusSearch();
    }
    @Override
    public void run(){
        resultslist.clearResults();
        SearchResult[] results;
        int page = 1;
        do{
            results = campussearch.search(query, page);
            //System.out.println(results[0].full_path);
            resultslist.addSearchResults(results);
            page++;
        }while(results.length>=30 && page<10);
    }
}
